/*
 * 
 * Copyright (C) 2010 Wilfried Elmenreich, Anita Sobe 
 * This file is part of VideoNetwork.
 * 
 * VideoNetwork is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
 * You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. 
 */
package proxy;

public class Configuration {

	/**
	 * 
	 */
	private static long standardCapacity = 50000000; // in bytes
	/**
	 * When does the cleanup start?
	 */
	private double diskfullCleanupLimit = 0.31;
	/**
	 * 
	 */
	private long diskCapacity;

	private double percOfTagsRanking = 0.5;

	/**
	 * use hormone level for prioritizing transmissions
	 */
	private boolean prioritizeTransmission;

	/**
	 * use generalization for searchscenario
	 */
	private boolean searchwithgeneralization;

	/**
	 * use direct download for ref-scenario
	 */
	private boolean directDownload;

	public enum CleanUpType {
		LRU, THREEWAY, LFU, HORMONE
	};

	private CleanUpType cleanup;

	/**
	 * 
	 */
	public Configuration() {
		this(CleanUpType.THREEWAY, true, standardCapacity, true);
	}

	/**
	 * 
	 * @param capacity
	 */
	public Configuration(int capacity) {
		this(CleanUpType.THREEWAY, true, capacity, true);
	}

	/**
	 * 
	 * @param useLRUcleanUp
	 * @param prioritizeTransmission
	 */
	public Configuration(CleanUpType cleanup, boolean prioritizeTransmission) {
		this(cleanup, prioritizeTransmission, standardCapacity, true);
	}

	public Configuration(CleanUpType cleanup, boolean prioritizeTransmission,
			boolean searchwithGeneralization) {
		this(cleanup, prioritizeTransmission, standardCapacity,
				searchwithGeneralization);
	}

	/**
	 * 
	 * @param cleanup
	 * @param prioritizeTransmission
	 * @param capacity
	 * @param searchwithgeneralization
	 */
	public Configuration(CleanUpType cleanup, boolean prioritizeTransmission,
			long capacity, boolean searchwithgeneralization) {
		this.cleanup = cleanup;
		this.prioritizeTransmission = prioritizeTransmission;
		this.diskCapacity = capacity;
		this.searchwithgeneralization = searchwithgeneralization;
	}

	public boolean isSearchwithgeneralization() {
		return searchwithgeneralization;
	}

	public void setSearchwithgeneralization(boolean searchwithgeneralization) {
		this.searchwithgeneralization = searchwithgeneralization;
	}

	public static long getStandardCapacity() {
		return standardCapacity;
	}

	public long getDiskCapacity() {
		return this.diskCapacity;
	}

	public boolean isUseLRUcleanUp() {
		return this.cleanup == CleanUpType.LRU;
	}

	public boolean isPrioritizeTransmission() {
		return prioritizeTransmission;
	}

	public double getDiskfullCleanupLimit() {
		return diskfullCleanupLimit;
	}

	public void setDiskfullCleanupLimit(double diskfullCleanupLimit) {
		this.diskfullCleanupLimit = diskfullCleanupLimit;
	}

	public CleanUpType getCleanup() {
		return cleanup;
	}

	public void setCleanup(CleanUpType cleanup) {
		this.cleanup = cleanup;
	}

	public boolean isDirectDownload() {
		return directDownload;
	}

	public void setDirectDownload(boolean directDownload) {
		this.directDownload = directDownload;
	}

	public double getPercOfTags() {
		return percOfTagsRanking;
	}

	public void setPercOfTags(double percOfTags) {
		this.percOfTagsRanking = percOfTags;
	}

}
